home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Think Class Libraries / CommToolbox (modified) / Sources / stringx.c < prev   
Encoding:
C/C++ Source or Header  |  1994-11-30  |  893 b   |  45 lines  |  [TEXT/KAHL]

  1.  
  2. /*
  3.  *  stringx.c
  4.  *
  5.  *    miscellaneous string functions
  6.  *
  7.  *  Copyright (c) 1994 Ithran Einhorn.  All rights reserved.
  8.  *
  9.  */
  10.  
  11.  
  12. #include "stringx.h"
  13.  
  14. /******************************************************************************
  15.  stricmp
  16.  
  17.         case insensitive string compare.
  18.  ******************************************************************************/
  19.  
  20. int stricmp(const char * s1, const char *s2)
  21. {
  22.     while (*s1 && *s2 && (*s1 & 0xDF) == (*s2 & 0xDF))
  23.     {
  24.         s1++; s2++;
  25.     }
  26.     return (int)(*s1 - *s2);
  27. }
  28.  
  29. /******************************************************************************
  30.  TrimRight
  31.  
  32.         calculate number of characters in TM buffer.
  33.  ******************************************************************************/
  34.  
  35. char *TrimRight(char *t_str)
  36. {
  37.     register long pos;
  38.     
  39.     for (pos = strlen(t_str) - 1; pos >= 0 && isspace(t_str[pos]); pos--)
  40.          t_str[pos] = 0;
  41.             
  42.     return t_str;
  43. }
  44.  
  45.